<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('供应商列表')" />
    <th:block th:include="include :: select2-css" />

</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>供应商名称：</label>
                                <input type="text" name="name"/>
                            </li>
                            <li>
                                <label>营业执照号码：</label>
                                <input type="text" name="bizLicenseNum"/>
                            </li>
                            <li>
                                <label>跟踪单位：</label>
                                <select class="form-control m-b" name="apartment" th:with="type=${@dict.getType('sys_supplier_apartment')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>

                            <li>
                                <label>是否合格：</label>
                                <select class="form-control m-b" name="isQualified" th:with="type=${@dict.getType('sys_yes_no')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>供应商来源：</label>
                                <input type="text" name="source"/>
                            </li>
                            <li>
                                <label>供应商等级：</label>
                                <select class="form-control m-b" name="grade" th:with="type=${@dict.getType('sys_supplier_grade')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>供应商分类：</label>
                                <select class="form-control m-b" name="cate" th:with="type=${@dict.getType('sys_supplier_cate')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>证书等级：</label>
                                <select class="form-control m-b" name="certificateGrade" th:with="type=${@dict.getType('sys_cir_grade')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>分包专业：</label>
                                <select class="form-control m-b" name="subcontract" th:with="type=${@dict.getType('sys_supplier_fenbao')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:supplier:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:supplier:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:supplier:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>

            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: select2-js" />

     <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:supplier:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:supplier:remove')}]];
        var isQualifiedDatas = [[${@dict.getType('sys_yes_no')}]];
        var gradeDatas = [[${@dict.getType('sys_supplier_grade')}]];
        var cateDatas = [[${@dict.getType('sys_supplier_cate')}]];
        var prefix = ctx + "system/supplier";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "供应商",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'name',
                    title: '供应商名称',
                    width: 376,
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,14);
                    }
                },
                {
                    field: 'bizLicenseNum',
                    title: '营业执照号码'
                },
                {
                    field: 'apartment',
                    title: '跟踪单位',
                    width: 376,
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,14);
                    }
                },
                {
                    field: 'contact',
                    title: '联系人',
                    width: 150
                },
                {
                    field: 'isQualified',
                    title: '是否合格',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(isQualifiedDatas, value);
                    }
                },
                {
                    field: 'source',
                    title: '供应商来源',
                    width: 376,
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,14);
                    }
                },
                {
                    field: 'grade',
                    title: '供应商等级',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(gradeDatas, value);
                    }
                },
                {
                    field: 'cate',
                    title: '供应商分类',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(cateDatas, value);
                    }
                },
                {
                    field: 'certificateGrade',
                    title: '证书等级'
                },
                {
                    field: 'subcontract',
                    title: '分包专业'
                },
                {
                    field: 'bank',
                    title: '开户行',
                    width: 376,
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,13);
                    }
                },
                {
                    field: 'account',
                    title: '收款账号'
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>